class Solution:
    def uniqueOccurrences(self, arr: List[int]) -> bool:
        arr.sort()
        mapper={}
        before=arr[0]
        count=0
        for i in range(len(arr)):
            if arr[i]==before:
                count+=1
            else:
                try:
                    temp=mapper[count]
                    return False
                except KeyError:               
                    mapper[count]=before
                    before=arr[i]                
                    count=1
        try:
            temp=mapper[count]
            return False
        except KeyError:
            return True